package test.t1;

public class test_two {
    public static int SunRecursive(int n){
        if(n<1){
            throw new IllegalArgumentException("N必须大于0");

        }
        int sum=0;
        for (int i = 0; i <=n; i++) {
            sum+=i;
        }
        return sum;
    }

    public static void main(String[] args) {

        int n=100;
        System.out.println("1到"+n+"的和: "+SunRecursive(n));
    }
}
